package com.sanjiahantang.youjiaclient.module.me.scheme.views.impl;

import android.view.View;
import android.widget.ListView;
import android.widget.TextView;

import com.sanjiahantang.uilibrary.adapter.listview.QuickAdapter;
import com.sanjiahantang.youjiaclient.R;
import com.sanjiahantang.youjiaclient.base.BaseMvpActivity;
import com.sanjiahantang.youjiaclient.module.me.scheme.presenters.MeSchemePresenter;
import com.sanjiahantang.youjiaclient.module.me.scheme.views.MeSchemeView;

import net.lucode.hackware.magicindicator.MagicIndicator;
import net.lucode.hackware.magicindicator.buildins.commonnavigator.CommonNavigator;
import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.CommonNavigatorAdapter;

/**
 * Created by zy on 2017/9/8.
 */

public class MeSchemeActivity extends BaseMvpActivity<MeSchemeView, MeSchemePresenter> implements MeSchemeView, View.OnClickListener, MeSchemeView.OnLoadListener {


    private View back;
    private MagicIndicator miTabs;
    private ListView listView;

    @Override
    public void showProgress() {
        super.showProgress($this);
    }

    @Override
    public MeSchemePresenter initPresenter() {
        return new MeSchemePresenter();
    }

    @Override
    public void initView() {
        setContentView(R.layout.activity_scheme);

        TextView title = (TextView) findViewById(R.id.title);
        title.setText("我的方案");
        back = findViewById(R.id.fl_Left);
        back.setOnClickListener(this);

        miTabs = (MagicIndicator) findViewById(R.id.miTabs);
        listView = (ListView) findViewById(R.id.listView);
        listView.setSelector(R.color.transparent);
    }

    @Override
    public void initData() {
        presenter.loadMySchemeList($this, this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.fl_Left:
                finish();
                break;

        }
    }

    @Override
    public void initTabs(CommonNavigatorAdapter adapter) {
        final CommonNavigator commonNavigator = new CommonNavigator($this);
        commonNavigator.setAdapter(adapter);
        miTabs.setNavigator(commonNavigator);
    }

    @Override
    public void switchPages(int index) {
        miTabs.onPageSelected(index);
    }

    @Override
    public void initList(QuickAdapter adapter) {
        listView.setAdapter(adapter);
    }
}
